//
//  CellOfTableView.m
//  23-QQMusic
//
//  Created by ParkourH on 16/8/15.
//  Copyright © 2016年 ParkourH. All rights reserved.
//

#import "CellOfTableView.h"
#import "MVConllectionList.h"
#import "CellOfCollectionView.h"

#define kCollectionViewCellReuse @"pool"
#define kScreenWidth [UIScreen mainScreen].bounds.size.width
#define kScreenHeight [UIScreen mainScreen].bounds.size.height

@interface CellOfTableView () <UICollectionViewDelegate, UICollectionViewDataSource, UICollectionViewDelegateFlowLayout>

@property (weak, nonatomic) IBOutlet UICollectionView *qq_MVCollectionView;


@end

@implementation CellOfTableView

-(void)setMvListArray:(NSArray<MVConllectionList *> *)mvListArray {

    _mvListArray = mvListArray;
    
    [_qq_MVCollectionView reloadData];
}



- (NSInteger)collectionView:(UICollectionView *)collectionView numberOfItemsInSection:(NSInteger)section {

    return _mvListArray.count;
}

- (UICollectionViewCell *)collectionView:(UICollectionView *)collectionView cellForItemAtIndexPath:(NSIndexPath *)indexPath {

    CellOfCollectionView *cell = [collectionView dequeueReusableCellWithReuseIdentifier:kCollectionViewCellReuse forIndexPath:indexPath];
    
    cell.collectionListModel = self.mvListArray[indexPath.item];
    return cell;
}


- (CGSize)collectionView:(UICollectionView *)collectionView layout:(UICollectionViewLayout *)collectionViewLayout sizeForItemAtIndexPath:(NSIndexPath *)indexPath {

    if (indexPath.item == 0) {
        
        
        return CGSizeMake(CGRectGetWidth(collectionView.bounds), CGRectGetHeight(collectionView.bounds) / 2 - 15);
    } else {
    
        return CGSizeMake((CGRectGetWidth(collectionView.bounds) - 5)/ 2, CGRectGetHeight(collectionView.bounds) / 4);
    }
}


- (void)awakeFromNib {
    [super awakeFromNib];
    // Initialization code
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
